var express = require('express');
var router = express.Router();
var Comment = require('../models/comment.js');

router.get('/',function(req,res,next){
    var articleId = req.query.articleId;
    Comment.getAllByArticleId(articleId,function(err,comments){
        if(err){
            console.log("err:"+err);
            res.json({"success":false,message:'获取评论失败',comments:[]});
        }else{
            res.json({"success":true,message:'获取评论成功',comments:comments});
        }
    })
});
module.exports = router;